﻿	      <?php include("conn.php");
             mysql_query('SET NAMES UTF8'); 

	  

class MyPrizeBean
{

	public $name;
	public $shopid;
	public $shopname;
	public $images;
	public $title;
	public $xuanxiang;
	public $jiage;
	public $shuliang;
	public $carid;
	public $zongjia;

	function __construct($name,$shopid,$shopname,$images,$title,$xuanxiang,$jiage,$shuliang,$carid,$zongjia)
	{
	
		$this->name      = $name;
		$this->shopid    = $shopid;
		$this->shopname    = $shopname;
		$this->images    = $images;
		$this->title    = $title;
		$this->xuanxiang    = $xuanxiang;
		$this->jiage    = $jiage;
		$this->shuliang    = $shuliang;
		$this->carid    = $carid;
		$this->zongjia    = $zongjia;
	}
}





   if($_POST["sid"]!="")
   {
   $de=$_POST["sid"]*30;
   }
    else
	{
	$de=0;
	}
	$uid=$_REQUEST[uid];
	$state=1;
	$statety=3;
	
	
	$zongj=0;
	if ($_REQUEST[cityid]!='') {
		$rert30=mysql_query("select *from car where userid='".$uid."' and cityid='".$_REQUEST[cityid]."' and (state='".$state."' or  state='".$statety."')");
	}else {
		$rert30=mysql_query("select *from car where userid='".$uid."' and (state='".$state."' or  state='".$statety."')");		
	}
	
	
	while($rowf3=mysql_fetch_array($rert30)){
	
	$zongj=$zongj+$rowf3[price]*$rowf3[number];
	
	}
	 $i=0;
	if ($_REQUEST[cityid]!='') {
		$rert35=mysql_query("select DISTINCT (shopid) from car where userid='".$uid."' and cityid='".$_REQUEST[cityid]."' and (state='".$state."' or  state='".$statety."')  order by carid desc limit $de,30");
	}else {
		$rert35=mysql_query("select DISTINCT (shopid) from car where userid='".$uid."' and (state='".$state."' or  state='".$statety."')  order by carid desc limit $de,30");
	}
		
	
	$prize = array();
	
	while($rowf=mysql_fetch_array($rert35)){
	

    

 $rert32=mysql_query("select *from shop where  shopid ='".$rowf[shopid]."'");
$rowf2=mysql_fetch_array($rert32);

 $content="";
       
		
		         $images1=array();
				 $title1=array();
				  $xuanxiang1=array();
				 $jiage1=array();
				 $shuliang1=array();
				 $carid1=array();
				 
				    $images2="";
				 $title2="";
				  $xuanxiang2="";
				 $jiage2="";
				 $shuliang2=$rowf1['number'];
				 $carid2="";
				 
				 
				  $rert36=mysql_query("select *from car where userid='".$uid."' and (state='".$state."' or  state='".$statety."') and shopid ='".$rowf[shopid]."' order by carid desc ");

	while($rowf6=mysql_fetch_array($rert36)){

     $prices=$rowf6[price]*$rowf6[number];
		$rert31=mysql_query("select *from goods where  goodsid ='".$rowf6[goodsid]."'");
$rowf1=mysql_fetch_array($rert31);

$st1=1;
$ime=$rowf1[images];
				$de = array();
				$de=explode("," ,$ime);
				$imagess=$de[0];
		
		
		    $images2.=",".$imagess;
				 $title2.=",".$rowf1['title'];
				  $xuanxiang2.=",".$rowf1['goodsselect'];
				 $jiage2.=",".$rowf1['price'];
				 $shuliang2.=",".$rowf6['number'];
				  $carid2.=",".$rowf6['carid'];
				  
				  
				  }
				   $images1=explode("," ,$images2);
				 $title1=explode("," , $title2);
				  $xuanxiang1=explode("," ,$xuanxiang2);
				 $jiage1=explode("," ,$jiage2);
				 $shuliang1=explode("," ,$shuliang2);
				 $carid1=explode("," ,$carid2);
				
		

$zongjs=0;

$prize[] = new MyPrizeBean($rowf2['name'],$rowf[shopid],$rowf2[name],$images1,$title1,$xuanxiang1,$jiage1,$shuliang1,$carid1,$zongjs);
		
}	

echo json_encode($prize);


?>